package com.itheima.reggie.controller;

import com.itheima.reggie.common.ResultInfo;
import com.itheima.reggie.domain.Dish;
import com.itheima.reggie.service.SetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RestController
public class SetmealController {

@Autowired
private SetmealService setmealService;

    // 点击图片 自动弹出套餐
    @GetMapping("/setmeal/dish/{id}")
    public ResultInfo taocan(@PathVariable Long id){ //接收参数，路径传参  要用@PathVariable
        // 调用方法
        List<Dish> dishList= setmealService.taocan(id);
        // 返回结果
        return ResultInfo.success(dishList);

    }
}
